package com.publishsystem.util.page;

import java.util.ArrayList;

/**
 * @author fzc
 * @date 2018-8-8 21:32
 */
public class ResultInfo {
    private Object obj;
    private Boolean success;
    private Integer errCode;
    private String errMsg;

    public static ResultInfo success() {
        return ResultInfo.success(new ArrayList<>());
    }

    public static ResultInfo success(Object obj) {
        ResultInfo result = new ResultInfo();
        result.setSuccess(true);
        result.setErrCode(0);
        result.setObj(obj);
        result.setErrMsg("");
        return result;
    }

    public static ResultInfo fail(String errMsg) {
        ResultInfo result = new ResultInfo();
        result.setSuccess(false);
        result.setErrCode(1);
        result.setObj(new ArrayList<>());
        result.setErrMsg(errMsg);
        return result;
    }

    public Integer getErrCode() {
        return errCode;
    }

    public void setErrCode(Integer errCode) {
        this.errCode = errCode;
    }

    public Object getObj() {
        return obj;
    }

    public void setObj(Object obj) {
        this.obj = obj;
    }

    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public String getErrMsg() {
        return errMsg;
    }

    public void setErrMsg(String errMsg) {
        this.errMsg = errMsg;
    }
}
